<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp" %>

<form name="form1" id="form1" action="${systemctx}/sample/saveSample.web" method="post">
	<input type="hidden" name="errorPage" value="/systemmanage/user/v001" />
	<input type="hidden" id="userId" name="userId" value="" />
	<input type="hidden" id="idStr" name="idStr"/>
	
	<div class="pageMain">
	<div class="pageTitle">
	<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title") %><span></span>
	<%=MessageResourcesUtils.getMessage(request, "systemmanage.userreview.title") %><span></span>
	<%=MessageResourcesUtils.getMessage(request, "systemmanage.userreviewlist.title") %></div>
	<div class="pageBody">
 
	<div class="form-group">
		<ul>
			<li>
				<i></i>
				<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.authority.list.loginname") %></label>
				<span><input type="text" class="input-sm" id="username" name="username" value="" /></span>
			</li>
		</ul>
	</div>	
	</div>
	<div class="button-group">
		<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
		<input type="button" class="btn btn-default" onclick="comfrim()" value="<%=MessageResourcesUtils.getMessage(request, "common.button.check") %>" />
	</div>
	<br />
	<table width="100%">
	<tbody>
		<tr>
			<td>
				<table id="datagrid"></table>
			</td>
		</tr>
	</tbody>
	</table>
	</div>
</form>

<script type="text/javascript">	
 
$(document).ready(function() {
 
	//加载分页控件 datagrid
	$('#datagrid').issdatagrid({
			title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.userreviewlist.title") %>',
			width: 'auto',
			nowrap: true,
			singleSelect : false,
			autoRowHeight: false,
			striped: true,
			//collapsible:true,
			url:'${systemctx}/user/queryCheckUserListInfoDataGrid.json',
			sortName : 'modifytime',
			sortOrder : 'desc',
			remoteSort: true,
			idField:'id',
			pagination:true,
			rownumbers:true,
			queryParams:$('#form1').serializeObject(),
			columns:[[{field:'ck', checkbox:true},
			          	{title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.User.add.usercode")%>',field : 'userno',width : 120,sortable : true,align : 'left',formatter:function(value,row,index){
			            	 return "<a href=\"javascript:void(0)\" onclick=\"view('"+row.id+"')\">"+value+"</a>"
			             }},
						{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.userloginname") %>', field:'loginname', width:120, sortable:true},
						{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.username") %>', field:'username', width:120, sortable:true},
						{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.validstart") %>', field:'validstart', width:120, sortable:true,align:'center'},
						{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.validend") %>', field:'validend', width:120, sortable:true,align:'center'},
						{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.inputuser") %>', field:'inputname', width:120, sortable:true},
						{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.status") %>', field:'checkstatus', width:120, sortable:true,align:'center'},
				{field:'id', hidden:true},
				{field:'status', hidden:true}
			]],
			onLoadSuccess : function(data){

			}
	});
 
	
	$('#butQuery').click(function (){
		$('#datagrid').datagrid('load', 
				$('#form1').serializeObject()
			);
	});
	
	
});

function userAdd() {
	$(this).isswindow({
		title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.title") %>',
		noheader : true,
		url : '${systemctx}/systemmanage/user/toAddUser.web'
	});
}

function comfrim()
{
	var idStr="";
	var rows=$('#datagrid').datagrid("getChecked");
	if(rows.length<1){
		alert("<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.update.checkone") %>");
		return;
	}else{
		for(var i=0;i<rows.length;i++){
			/* statusid=rows[i]["status"];
			if(statusid=="2"){
				alert("勾选的数据中有已复核的信息 不允许删除！");
				return;
			} */
			idStr=rows[i]["id"] + "," + idStr;
		}
	}
	$('#idStr').val(idStr);
	if (confirm("<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.jsp.alert3") %>")) {
		checkUser();
	}
}

function checkUser() {
	var id = $('#idStr').val();
	//正在执行...
	showSending();
	$.ajax({
		type : 'POST',
		url : '${systemctx}/systemmanage/user/checkUser.json?id='+id,
		dataType : 'json',
		success : function(data) {
			//关闭执行...
			closeSending();
			if(data.message == "<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.java.alert8") %>"){
				//显示AJAX请求后的提示信息
				$.fn.ajaxmessage(data);
				$('#datagrid').datagrid('reload',$('#form1').serializeObject());
				$('#datagrid').datagrid('clearSelections');
			}else if(data.message == "<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.java.alert9") %>"){
				$.fn.ajaxmessage(data);
			}
		}
	});
}

function fnModify(id){
	$(this).isswindow({
		title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.User.add.title") %>',
		noheader : true,
		url : '${systemctx}/systemmanage/user/toUpdateUser.web?userid='+id
	});
}
 
function view(id){
	$(this).isswindow({
		title : '',
		noheader : true,
		url : '${systemctx}/systemmanage/user/toViewUser.web?id='+id
	});
}
</SCRIPT>

<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp" %>